home *** CD-ROM | disk | FTP | other *** search
/ El Mac 1 / Magazine.iso / EL MAC 1 / Shareware / HyperCard / XCMD Docs / CompileIt! Source Code / Control_Drag_Enabler_INIT < prev    next >
Encoding:
Text File  |  1995-08-20  |  954 b   |  28 lines  |  [TEXT/ttxt]

  1. codeResource "INIT" 128
  2.  
  3. pascal on Control_Drag_Enabler_INIT
  4.   repeat 3
  5.     get CompactMem($7FFFFFFF)
  6.     PurgeMemSys $7FFFFFFF
  7.   end repeat
  8.   AddGestalt "fnd≈",1
  9. end Control_Drag_Enabler_INIT
  10.  
  11. on AddGestalt type,val
  12.   put getNamedResource("valR","MyGestaltValue") into myhndl
  13.   if myHndl=0 then
  14.     SysBeep 20
  15.     return "Could not load 'valR' resource. This resource is needed!"
  16.   end if
  17.   put NewPtrSys(22) into myPtr -- ••• change me
  18.   blockMove myHndl@,myPtr,22 -- ••• change me
  19.   
  20.   put MyPtr into dataAddr  -- ••• IF YOU CHANGE THE FUNCTION STORED IN THE 'valR' RESOURCE YOU _MUST_ CHANGE THIS TOO. FAILURE TO DO SO WILL MOST LIKELY RESULT IN A CRASH. THIS IS THE ADDRESS WHERE COMPILEIT! MUST PUT THE ANSWER TO GIVE.
  21.   put val into dataAddr@.longintType
  22.   return NewGestalt(type,(myPtr+4)) -- ••• CHANGE ME TOO!
  23. end AddGestalt
  24.  
  25. --valR is now written in Assembly laungauge. CompileIt! made 532 bytes of unessisary junk.
  26.  
  27. --TOTAL SIZE: 22 bytes!!!
  28.